package com.senlingspace.payment.enums;

/**
 * 拉卡拉交易类型枚举
 *
 * @author lebronjames
 * @date 2024/07/24
 */
public enum LakalaTradeMainTypeEnum {

    PREORDER("PREORDER", "主扫"),
    MICROPAY("MICROPAY", "被扫"),
    REFUND("REFUND", "退款"),
    CANCEL("CANCEL", "撤销"),
    OTHER("无", "其它类型");

    private final String code;
    private final String description;

    LakalaTradeMainTypeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static LakalaTradeMainTypeEnum fromCode(String code) {
        for (LakalaTradeMainTypeEnum type : values()) {
            if (type.getCode().equalsIgnoreCase(code)) {
                return type;
            }
        }
        return OTHER;
    }

}
